<template>
  <div class="child">
    <h3>子组件</h3>
    <button @click="emits('save-toy', toy)">点我给父亲玩具</button>
  </div>
</template>

<script setup lang="ts" name="Child">
import { ref } from "vue";

const emits = defineEmits(["save-toy"]);

let toy = ref("奥特曼");
</script>

<style scoped>
.child {
  margin-top: 10px;
  background-color: rgb(185, 219, 185);
  padding: 10px;
  box-shadow: 0 0 10px black;
  border-radius: 10px;
}
</style>
